package com.anycl.design.behavioral.visitor.instance;

import java.util.LinkedList;
import java.util.List;

/**
 * ObjectStructure角色
 */
public class Computer {

    private List<Element> elements = new LinkedList<>();
    {
        elements.add(new FileElement("Element.java", "file"));
        elements.add(new FolderElement("Java", "folder"));
    }

    public void showFileAndFolder(Visitor visitor){
        for (Element element: elements) {
            element.accept(visitor);
        }
    }
}
